/**
 * 
 */
package meituan;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 最长公共连续子串 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
		String s1=scanner.nextLine();
		String s2=scanner.nextLine();
		System.out.println(getMaxCommonLen(s1,s2));
	}

	private static int getMaxCommonLen(String s1, String s2) {
		int n=s1.length();
		int m=s2.length();
		int[][] dp=new int[n][m];
		int max=0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if(s1.charAt(i)==s2.charAt(j)){
					dp[i][j]=1+(i>0&&j>0?dp[i-1][j-1]:0);
					max=Math.max(max, dp[i][j]);
				}else {
					dp[i][j]=0;
				}
			}
		}
		return max;
	}

}
